Set Variable SQL2005 to 
Set Variable SQLUPGRADE to FALSE
Set Variable SQLINSTALLED to TRUE
Check Service State for MSSQL$SIGMANEST (write result into variable SQL2005)
Comment: MessageBox: SQL Status, SQL 2005 Status = $SQL2005$
if Variable SQL2005 Equals NOTINSTALLED
  Comment: SQL 2005 Express has stringent operating system and service pack requirements
  Get System Setting Windows 2003 into IS2003
  if Variable IS2003 Equals TRUE
    Comment: Check Service Pack 1 for Windows Server 2003
    Get System Setting Service Pack 1 into ISSP1
    if Variable ISSP1 Equals FALSE
      Get System Setting Windows Vista into ISVISTA
      if Variable ISVISTA Equals FALSE
        MessageBox: $TITLE$ Setup, $TITLE$ requires at least Service Pack 1 or later. Please upgrade your operating system and try again.$NEWLINE$$NEWLINE$$TITLE$ Setup cannot continue.
        Set Variable SQLINSTALLED to TRUE
        Comment: Terminate Installation
      end
    end
  else
    Get System Setting Windows XP into ISXP
    if Variable ISXP Equals TRUE
      Comment: Check Service Pack 2 for Windows XP
      Get System Setting Service Pack 2 into ISSP2
      if Variable ISSP2 Equals FALSE
        MessageBox: $TITLE$ Setup, $TITLE$ requires at least Service Pack 2 or later. Please upgrade your operating system and try again.$NEWLINE$$NEWLINE$$TITLE$ Setup cannot continue.
        Set Variable SQLINSTALLED to TRUE
        Comment: Terminate Installation
      end
    else
      Comment: Check Service Pack 4 for Windows 2000
      Get System Setting Service Pack 4 into ISSP4
      if Variable ISSP4 Equals FALSE
        MessageBox: $TITLE$ Setup, $TITLE$ requires at least Service Pack 4 or later. Please upgrade your operating system and try again.$NEWLINE$$NEWLINE$$TITLE$ Setup cannot continue.
        Set Variable SQLINSTALLED to TRUE
        Comment: Terminate Installation
      end
    end
  end
  Set Variable SQLINSTALLED to FALSE
else
  Set Variable SQLINSTALLED to TRUE
  Read Registry Key HKLM\Software\Microsoft\Microsoft SQL Server\SigmaNEST\MSSQLServer\CurrentVersion\CurrentVersion into SQLVERSION
  Parse String $SQLVERSION$ into Variables SQLVERSIONMAJOR and SQLVERSIONMINOR (Split at first occurrence of pattern)
  if Variable SQLVERSIONMAJOR Greater Than 7
    Set Variable SQLUPGRADE to FALSE
  else
    Set Variable SQLUPGRADE to TRUE
  end
end
 
